package qc.module.qms.mapper;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
import qc.module.qms.dto.exchange.log.DataExchangeLogDto;
import qc.module.qms.entity.ExchangeLog;

import java.util.List;

/**
 * ExchangeLogMapper
 *
 * @author QuCheng Tech
 * @since 2024/9/25
 */
@Mapper
public interface ExchangeLogMapper {
    ExchangeLogMapper MAPPER = Mappers.getMapper(ExchangeLogMapper.class);

    @Mapping(target = "begintm", source = "begintm", dateFormat = "yyyy-MM-dd HH:mm:ss.SSS")
    @Mapping(target = "endtm", source = "endtm", dateFormat = "yyyy-MM-dd HH:mm:ss.SSS")
    @Mapping(target = "exectm", source = "exectm", dateFormat = "yyyy-MM-dd HH:mm:ss.SSS")
    @Mapping(target = "intm", source = "intm", dateFormat = "yyyy-MM-dd HH:mm:ss.SSS")
    @Mapping(target = "optype", source = "optype.index")
    DataExchangeLogDto toDto(ExchangeLog en);

    List<DataExchangeLogDto> toDtoList(List<ExchangeLog> list);
}
